<?php
/*************************************************************************************
 * geoip.php
 * -----------
 * phpGMapTrips 
 * 
 * This php application allows you to easily record your travel destinations 
 * and display them with Google maps.
 * 
 * Author: Stephane Coste (lescoste@gmail.com)
 * Copyright: (c) 2006 Stephane Coste (http://lescoste.net/)
 * Release Version: 0.1
 * CVS Revision Version: $Revision: 1.4 $
 * Date Started: 2006/02/19
 * Last Modified: $Date: 2007/03/08 20:44:29 $
 *
 *************************************************************************************
 *
 *     This file is part of phpGMapTrips.
 *
 *   phpGMapTrips is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   phpGMapTrips is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with phpGMapTrips; if not, write to the Free Software
 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 ************************************************************************************/
?>
<?php 
$visitorIp = urldecode($_GET["ip"]);
if (empty($visitorIp)) {
   $visitorIp = $_SERVER["REMOTE_ADDR"];
}
$pos = strpos($visitorIp, "192");
if ($pos===false) {
} else if ($pos==0) {
	// use google ip if ip starts with 192
	$visitorIp = "64.208.49.61";
}
echo $visitorIp;
?>
<br/>
<a href="http://api.hostip.info/get_html.php?position=true&ip=<?php echo $visitorIp; ?>">hostip query</a>
<br/>
<a href="http://network-tools.com/default.asp?prog=lookup&Netnic=whois.arin.net&host=<?php echo $visitorIp; ?>">dns query</a>
<br/>
<a href="http://www.maxmind.com/app/locate_ip">maxmind query</a>

<br/>
<a href="editpoint.php?file=visitors&showpoint=<?php echo urlencode($visitorIp); ?>">editPoint</a>

<br/>
<?php
include_once("geoipquery.php");
echo " long=".$editLng;
echo " lat=".$editLat;
?>
